package org.lq.ssm.controller;

import org.lq.ssm.Web.HttpResult;
import org.lq.ssm.dto.RoleDTO;
import org.lq.ssm.po.RolePO;
import org.lq.ssm.po.UserPO;
import org.lq.ssm.service.RoleService;
import org.lq.ssm.service.UserService;
import org.lq.ssm.vo.RoleVO;
import org.lq.ssm.vo.UserVO;
import org.lq.ssm.vo.mapper.RoleVOMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/role")
public class RoleController {

    @Autowired
    RoleService roleService;



    @GetMapping("getallRole.do")
    public HttpResult<List<UserVO>> getAllUser(String level){
        List<RoleDTO> allUser = roleService.getAllRole();
        List<RoleVO> roleVOS = RoleVOMapper.INSTANCE.roleDTOToVO(allUser);
        return HttpResult.ok(roleVOS,"数据没问题");
    }
}
